﻿using System;
using WISD.CarFriend.BLL.OA;

namespace WISD.CarFriend.Web.OA.Module.SubstituteDriving
{
    public partial class SubstituteDrivingAdd : Utility.BasicPage
    {
        private SubstituteDrivingModule m_SubstituteDrivingModuleBLL = new SubstituteDrivingModule();

        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    // 验证权限
                    base.CheckPermission("SubstituteDriving_Add");

                    this.txtMemo3.Text = DateTime.Now.ToString("yyyyMMddHHmmss");
                }
            }
            catch (Exception exception)
            {
                base.ShowMessageBox(350, 230, "错误提示", "<b>出现错误啦！</b>" + exception.Message.ToString(), "back", "Error");
            }
        }


        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                WISD.CarFriend.Model.CFModel.T_CF_OA_SubstituteDriving substituteDrivingModel
                    = new Model.CFModel.T_CF_OA_SubstituteDriving();
                substituteDrivingModel.Memo3 = this.txtMemo3.Text.Trim();
                substituteDrivingModel.Name = this.txtName.Text.Trim();
                substituteDrivingModel.MobileTel = this.txtMobileTel.Text.Trim();
                substituteDrivingModel.VehicleNo = this.txtVehicleNo.Text.Trim();
                substituteDrivingModel.Memo1 = this.txtMemo1.Text.Trim();
                substituteDrivingModel.Address = this.txtAddress.Text.Trim();
                substituteDrivingModel.Destination = this.txtDestination.Text.Trim();
                substituteDrivingModel.Mileage = decimal.Parse(this.txtMileage.Text.Trim());
                substituteDrivingModel.Remarks = this.txtRemarks.Text.ToString().Trim();
                substituteDrivingModel.Memo4 = Session["OA_MemberID"].ToString().Trim();
                substituteDrivingModel.State = 0;

                this.m_SubstituteDrivingModuleBLL.Add(substituteDrivingModel);
                ShowMessageBox("新增成功！", "SubstituteDrivingList.aspx", "Success");
            }
            catch (Exception exception)
            {
                base.ShowMessageBox(350, 230, "错误提示", "<b>出现错误啦！</b>" + exception.Message.ToString(), "back", "Error");
            }
        }


    }
}